<?php 
	
	
  if(!empty($_REQUEST['email'])){
		 
		 
			 	$email2 = $tool->getvar('email',$_POST); 
				$pass2 = $tool->getvar('password',$_POST); 
								
			  $existe = $tool->simple_db("select id,nombre,categoria1,date_format(fecha,'%d/%m/%Y') as fecha from cliente where email = '$email2' and password = '$pass2' and activo = 1");
			  if($tool->nreg>0){ $_SESSION['CLIENTE_ID'] = $existe['id'];
			  					 $_SESSION['CLIENTE_NOMBRE'] = $existe['nombre']; 
								 $_SESSION['CLIENTE_CATEGORIA'] = $existe['categoria1']; 
								 $_SESSION['CLIENTE_EMAIL'] = $email2; 
								 $_SESSION['CLIENTE_FECHA'] = $existe['fecha']; 
								 
                               if($_SESSION['IDTIPO']=='prod'){
							
								$tool->redirect('SV-detalle-producto.php?id='.$_SESSION['IDPROD']);
							
							
							}else if($_SESSION['IDTIPO']=='art'){
							
								$tool->redirect('SV-detalle-articulo.php?id='.$_SESSION['IDART']);
							
							}
							
							$tool->redirect("SV-userhome.php");
								 
			   }else{ $tool->javaviso("El email o el password no existe en nuestra base de datos. Por favor registrese","index.php"); }
			  		 
		 
		 
	}	 

 
?>